import {defineConfig} from 'vite'
import path from 'path';

export default defineConfig({
    root: './',
    base: '/dist/',
    server: {
        port: 3000,
        open: true,
        proxy: {
            '/chat-session': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                secure: false,
                withCredentials: true
            },
            '/chat-sse': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                secure: false,
                withCredentials: true,
                headers: {
                    'Accept': 'text/event-stream',
                    'Content-Type': 'text/event-stream'
                }
            }

        }
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src')
        }
    },
    build: {
        outDir: '../dist',
        emptyOutDir: true,
        rollupOptions: {
            input: {
                main: './index.html',
                "solonai-chat-session": './src/solonai-chat-session.html',
                "solonai-chat-simple": './src/solonai-chat-simple.html',
                "sse-chat.html": './src/solonai-chat-sse.html',
            },
        },
    }
})